﻿namespace Beetle
{
    using System;

    public abstract class ServerBase<T> : ServerBase where T: Package
    {
        protected ServerBase()
        {
        }

        protected override void OnConnected(object sender, ChannelEventArgs e)
        {
            e.Channel.SetPackage<T>().ReceiveMessage = new EventPacketRecievMessage(this.OnMessageReceive);
            e.Channel.ChannelError += new EventChannelError(this.OnError);
            e.Channel.BeginReceive();
        }

        protected virtual void OnMessageReceive(PacketRecieveMessagerArgs e)
        {
        }
    }
}

